#pragma once

#include <stdint.h>

class cmsisDapIO
{
public:
    cmsisDapIO();
    ~cmsisDapIO();

public:
    virtual int open(const char *devname) = 0;
    virtual void close() = 0;
    virtual int read(struct cmsis_dap *dap, int timeout_ms) = 0;
    virtual int write(struct cmsis_dap *dap, int len, int timeout_ms) = 0;
    virtual int packet_buffer_alloc(struct cmsis_dap *dap, unsigned int pkt_sz) = 0;
};

struct cmsis_dap 
{
	uint16_t caps;
	uint8_t mode;
    uint16_t packet_size;
    uint8_t *packet_buffer;
    uint16_t packet_buffer_size;
    uint8_t *command;
    uint8_t *response;

    cmsisDapIO *backend;
};
